#ifndef __DRV_RTT_KEY_H_
#define __DRV_RTT_KEY_H_
#include "board.h"

#if defined(BOARD_CONFIG_RTT_KEY0_PIN) && defined(BOARD_CONFIG_RTT_KEY0_ACTIVATE)
  #define BORAD_KEY0                CONS3(P,BOARD_CONFIG_RTT_KEY0_PORT,in(BOARD_CONFIG_RTT_KEY0_NUM))
#else
  #define BOARD_CONFIG_RTT_KEY0_ACTIVATE  0
  #define BORAD_KEY0                (!BOARD_CONFIG_RTT_KEY0_ACTIVATE)
#endif
#if defined(BOARD_CONFIG_RTT_KEY1_PIN) && defined(BOARD_CONFIG_RTT_KEY1_ACTIVATE)
  #define BORAD_KEY1                CONS3(P,BOARD_CONFIG_RTT_KEY1_PORT,in(BOARD_CONFIG_RTT_KEY1_NUM))
#else
  #define BOARD_CONFIG_RTT_KEY1_ACTIVATE  0
  #define BORAD_KEY1                (!BOARD_CONFIG_RTT_KEY1_ACTIVATE)
#endif
#if defined(BOARD_CONFIG_RTT_KEY2_PIN) && defined(BOARD_CONFIG_RTT_KEY2_ACTIVATE)
  #define BORAD_KEY2                CONS3(P,BOARD_CONFIG_RTT_KEY2_PORT,in(BOARD_CONFIG_RTT_KEY2_NUM))
#else
  #define BOARD_CONFIG_RTT_KEY2_ACTIVATE  0
  #define BORAD_KEY2                (!BOARD_CONFIG_RTT_KEY2_ACTIVATE)
#endif
#if defined(BOARD_CONFIG_RTT_KEY3_PIN) && defined(BOARD_CONFIG_RTT_KEY3_ACTIVATE)
  #define BORAD_KEY3                CONS3(P,BOARD_CONFIG_RTT_KEY3_PORT,in(BOARD_CONFIG_RTT_KEY3_NUM))
#else
  #define BOARD_CONFIG_RTT_KEY3_ACTIVATE  0
  #define BORAD_KEY3                (!BOARD_CONFIG_RTT_KEY3_ACTIVATE)
#endif

#define K0_PREESED            0x01
#define K1_PREESED            0x02
#define K2_PREESED            0x04
#define K3_PREESED            0x08

#define delay_ms              rt_thread_mdelay

void key_pin_init(void);
unsigned char key_getState(void);
u8 KEY_Scan(u8 mode);

#endif // __DRV_RTT_KEY_H_
